package com.sylvan.java.responsedata;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 控制类
 *
 * @author sylvan
 * @create 2018-10-22 14:21
 **/
@RestController
@RequestMapping("/response")
public class Controller {

    /**
     * 测试请求成功
     * @return
     */
    @GetMapping("/test1")
    public ResponseData getData1(){
        return new ResponseData(HttpCode.OK,"这里放数据");
    }

    /**
     * 测试 当用户未登录
     * @return
     */
    @GetMapping("/test2")
    public ResponseData getData2(){
        return new ResponseData(HttpCode.UNAUTHORIZED);
    }

    /**
     * 测试 自定义
     * @return
     */
    @GetMapping("/test3")
    public ResponseData getData3(){
        return new ResponseData(800 , "测试自定义" , "测试数据");
    }

}
